<template>
	<view>
		<cu-custom :isBack="true" bgColor="bg-blue">
			<block slot="content">精轧区域监控</block>
			<template slot="backText">
				<text class="cuIcon-back" @tap="beforePage"></text>
			</template>
		</cu-custom>
		<!-- 主题内容 -->
		<view  class="padding-t">
			<view class="public-main-info">
				<view class="u-main padding2030">
					<!-- 精轧区域监控 -->
					<view class="mo-main">
						<image src="../../../static/img/rollJing.png" mode="widthFix" class="rollCu"></image>
						<view class="flex justify-around cu-zhuangtai width100">
							<view class="flex" >
								<view class="">
									<text class="ph-zhuangtai text-blue"></text>
								</view>
								<view class="font-size24 margin-left-10">
									<view class="u-font-weight">{{coilInfo.RmFault}}</view>
									<view class="u-font-weight6">状态</view>
								</view>
							</view>
							<view class="flex" >
								<view class="">
									<text class="ph-wendu text-blue"></text>
								</view>
								<view class="font-size24 margin-left-10">
									<view class="u-font-weight">{{coilInfo.temp}}℃</view>
									<view class="u-font-weight6">FDT</view>
								</view>
							</view>
							<view class="flex" >
								<view class="">
									<text class="ph-wendu text-blue"></text>
								</view>
								<view class="font-size24 margin-left-10">
									<view class="u-font-weight">{{coilInfo.tempFET}}℃</view>
									<view class="u-font-weight6">FET</view>
								</view>
							</view>
							<!-- <view class="flex" >
								<view class="">
									<text class="ph-ziyuan204 text-blue"></text>
								</view>
								<view class="font-size24 margin-left-10">
									<view class="u-font-weight">{{coilInfo.CoilWid}}</view>
									<view class="u-font-weight6">宽度</view>
								</view>
							</view>
							<view class="flex" >
								<view class="rotate">
									<text class="ph-ziyuan204 text-blue"></text>
								</view>
								<view class="font-size24 margin-left-10">
									<view class="u-font-weight">{{coilInfo.CoilThk}}</view>
									<view class="u-font-weight6">厚度</view>
								</view>
							</view> -->
						</view>
					</view>
					<!-- 钢卷信息 -->
					<view class="steel-coil-info dashed-bottom">
						<view class="u-font-weight font-size28 margin-b-10">钢卷信息</view>
						<view class="flex  font-size24 justify-between">
							<view>
								<text class="u-font-weight6">钢种</text>
								<text class="u-font-weight margin-left-10">{{coilInfo.steelGrade}}</text>
							</view>
							<view>
								<text class="u-font-weight6">钢卷号</text>
								<text class="u-font-weight margin-left-10">{{coilInfo.coilNo}}</text>
							</view>
							<view>
								<text class="u-font-weight6">规格</text>
								<text class="u-font-weight margin-left-10">{{coilInfo.CoilThk}}*{{coilInfo.CoilWid}}</text>
							</view>
						</view>
					</view>
					<!-- 轧机信息 -->
					<view class="roll-info">
						<view class="u-font-weight font-size28 margin-b-10">轧机信息</view>
						<view class="u-table">
							<view class="">
								<view class="u-table-head">
									<view class="u-table-head-item1">轧机</view>
									<view class="u-table-head-item1">速度</view>
									<view class="u-table-head-item1">辊缝</view>
									<view class="u-table-head-item1">轧制力</view>
									<view class="u-table-head-item1">电流</view>
								</view>
								<view class="u-table-bady">
									<view class="u-table-bady-column">
										<view class="u-table-head-item1">F1</view>
										<view class="u-table-head-item1">{{rollInfo1.speed}}</view>
										<view class="u-table-head-item1">{{rollInfo1.gap}}</view>
										<view class="u-table-head-item1">{{rollInfo1.force}}</view>
										<view class="u-table-head-item1">{{rollInfo1.current}}</view>
									</view>
									<view class="u-table-bady-column">
										<view class="u-table-head-item1">F2</view>
										<view class="u-table-head-item1">{{rollInfo2.speed}}</view>
										<view class="u-table-head-item1">{{rollInfo2.gap}}</view>
										<view class="u-table-head-item1">{{rollInfo2.force}}</view>
										<view class="u-table-head-item1">{{rollInfo2.current}}</view>
									</view>
									<view class="u-table-bady-column">
										<view class="u-table-head-item1">F3</view>
										<view class="u-table-head-item1">{{rollInfo3.speed}}</view>
										<view class="u-table-head-item1">{{rollInfo3.gap}}</view>
										<view class="u-table-head-item1">{{rollInfo3.force}}</view>
										<view class="u-table-head-item1">{{rollInfo3.current}}</view>
									</view>
									<view class="u-table-bady-column">
										<view class="u-table-head-item1">F4</view>
										<view class="u-table-head-item1">{{rollInfo4.speed}}</view>
										<view class="u-table-head-item1">{{rollInfo4.gap}}</view>
										<view class="u-table-head-item1">{{rollInfo4.force}}</view>
										<view class="u-table-head-item1">{{rollInfo4.current}}</view>
									</view>
									<view class="u-table-bady-column">
										<view class="u-table-head-item1">F5</view>
										<view class="u-table-head-item1">{{rollInfo5.speed}}</view>
										<view class="u-table-head-item1">{{rollInfo5.gap}}</view>
										<view class="u-table-head-item1">{{rollInfo5.force}}</view>
										<view class="u-table-head-item1">{{rollInfo5.current}}</view>
									</view>
									<view class="u-table-bady-column">
										<view class="u-table-head-item1">F6</view>
										<view class="u-table-head-item1">{{rollInfo6.speed}}</view>
										<view class="u-table-head-item1">{{rollInfo6.gap}}</view>
										<view class="u-table-head-item1">{{rollInfo6.force}}</view>
										<view class="u-table-head-item1">{{rollInfo6.current}}</view>
									</view>
									<view class="u-table-bady-column">
										<view class="u-table-head-item1">F7</view>
										<view class="u-table-head-item1">{{rollInfo7.speed}}</view>
										<view class="u-table-head-item1">{{rollInfo7.gap}}</view>
										<view class="u-table-head-item1">{{rollInfo7.force}}</view>
										<view class="u-table-head-item1">{{rollInfo7.current}}</view>
									</view>
								</view>
							</view>
						</view>
					</view>
				</view>
			</view>
		</view>
		<view class="cu-tabbar-height"></view>
	</view>
</template>

<script>
	import { post } from "@/lib/Util.js";
	export default {
		data() {
			return {
				coilInfo: {
					coilNo: '---',
					steelGrade: '---',
					CoilThk: '---',
					CoilWid: '---',
					RmFault: '---',
					temp: '---',
					tempFET: '---'
				},
				rollInfo1: {
					speed: 0,
					gap: 0,
					force: 0,
					current: 0
				},
				rollInfo2: {
					speed: 0,
					gap: 0,
					force: 0,
					current: 0
				},
				rollInfo3: {
					speed: 0,
					gap: 0,
					force: 0,
					current: 0
				},
				rollInfo4: {
					speed: 0,
					gap: 0,
					force: 0,
					current: 0
				},
				rollInfo5: {
					speed: 0,
					gap: 0,
					force: 0,
					current: 0
				},
				rollInfo6: {
					speed: 0,
					gap: 0,
					force: 0,
					current: 0
				},
				rollInfo7: {
					speed: 0,
					gap: 0,
					force: 0,
					current: 0
				},
				timer: null
			}
		},
		mounted() {
			this.getInfo()
			this.timer = setInterval(()=> {
				this.getInfo()
			}, 2000)
		},
		beforeDestroy() {
			clearInterval(this.timer)
			this.timer = null
		},
		methods: {
			beforePage() {
				uni.navigateBack({
					delta: 1
				});
			},
			async getInfo() {
				let coilNo = await post('/webservice/getHmiData', {
					tags: [
					    {
					      name: "FM_SCAN.CoilNo3", // 钢卷号
					      ts: "2"
					    }
					  ]
				})
				let steelGrade = await post('/webservice/getHmiData', {
					tags: [
						{
						  name: "FM_SET.SteelGrade", // 钢种
						  ts: "2"
						}
					  ]
				})
				let CoilThk = await post('/webservice/getHmiData', {
					tags: [
						{
						  name: "FM_SET.CoilThk", // 成品厚
						  ts: "1"
						},
					  ]
				})
				let CoilWid = await post('/webservice/getHmiData', {
					tags: [
						{
						  name: "FM_SET.CoilWid", // 成品宽
						  ts: "1"
						}
					  ]
				})
				let RmFault = await post('/webservice/getHmiData', {
					tags: [
					    {
					      name: "FM_SCAN.FM_Fault", // 是否异常
					      ts: "1"
					    }
					  ]
				})
				let temp = await post('/webservice/getHmiData', {
					tags: [
					    {
					      name: "FM_SCAN.FDT", // 温度
					      ts: "1"
					    }
					  ]
				})
				let tempFET = await post('/webservice/getHmiData', {
					tags: [
					    {
					      name: "FM_SCAN.FET", // 温度
					      ts: "1"
					    }
					  ]
				})
				if (coilNo.code == 0) {
					this.coilInfo.coilNo = coilNo.data.tagList[0].value
				}
				if (steelGrade.code == 0) {
					this.coilInfo.steelGrade = steelGrade.data.tagList[0].value
				}
				if (CoilThk.code == 0) {
					this.coilInfo.CoilThk = Number(CoilThk.data.tagList[0].value).toFixed(2)
				}
				if (CoilWid.code == 0) {
					this.coilInfo.CoilWid = Number(CoilWid.data.tagList[0].value).toFixed(2)
				}
				if(RmFault.code == 0) {
					if(RmFault.data.tagList[0].value == 1) {
						this.coilInfo.RmFault = '故障'
					}else {
						this.coilInfo.RmFault = '在轧'
					}
					
				}
				if(temp.code == 0) {
					this.coilInfo.temp = Number(temp.data.tagList[0].value).toFixed(3)
					this.coilInfo.tempFET = Number(tempFET.data.tagList[0].value).toFixed(3)
				}
				
				// 1#轧机
				let current1 = await post('/webservice/getHmiData', {
					tags: [
						{
						  name: "FM_SCAN.F1Current",
						  ts: "1"
						},
					  ]
				})
				let speed1 = await post('/webservice/getHmiData', {
					tags: [
						{
						  name: "FM_SCAN.F1Speed",
						  ts: "1"
						},
					  ]
				})
				let gapds1 = await post('/webservice/getHmiData', {
					tags: [
						{
						  name: "FM_SCAN.F1GapDS", // 辊缝DS
						  ts: "1"
						},
					  ]
				})
				let gapos1 = await post('/webservice/getHmiData', {
					tags: [
						{
						  name: "FM_SCAN.F1GapOS", // 辊缝OS
						  ts: "1"
						},
					  ]
				})
				let forceDs1 = await post('/webservice/getHmiData', {
					tags: [
						{
						  name: "FM_SCAN.F1ForceDS", // 轧制力DS
						  ts: "1"
						},
					  ]
				})
				let forceOs1 = await post('/webservice/getHmiData', {
					tags: [
						{
						  name: "FM_SCAN.F1ForceOS", // 轧制力OS
						  ts: "1"
						},
					  ]
				})
				this.rollInfo1.speed = speed1.data.tagList[0].value
				this.rollInfo1.gap = Number((Number(gapds1.data.tagList[0].value) + Number(gapos1.data.tagList[0].value)) / 2).toFixed(3)
				this.rollInfo1.force = Number((Number(forceDs1.data.tagList[0].value) + Number(forceOs1.data.tagList[0].value)) / 2).toFixed(3)
				this.rollInfo1.current = current1.data.tagList[0].value
				// 2#轧机
				let current2 = await post('/webservice/getHmiData', {
					tags: [
						{
						  name: "FM_SCAN.F2Current",
						  ts: "1"
						},
					  ]
				})
				let speed2 = await post('/webservice/getHmiData', {
					tags: [
						{
						  name: "FM_SCAN.F2Speed",
						  ts: "1"
						},
					  ]
				})
				let gapds2 = await post('/webservice/getHmiData', {
					tags: [
						{
						  name: "FM_SCAN.F2GapDS", // 辊缝DS
						  ts: "1"
						},
					  ]
				})
				let gapos2 = await post('/webservice/getHmiData', {
					tags: [
						{
						  name: "FM_SCAN.F2GapOS", // 辊缝OS
						  ts: "1"
						},
					  ]
				})
				let forceDs2 = await post('/webservice/getHmiData', {
					tags: [
						{
						  name: "FM_SCAN.F2ForceDS", // 轧制力DS
						  ts: "1"
						},
					  ]
				})
				let forceOs2 = await post('/webservice/getHmiData', {
					tags: [
						{
						  name: "FM_SCAN.F2ForceOS", // 轧制力OS
						  ts: "1"
						},
					  ]
				})
				this.rollInfo2.speed = speed2.data.tagList[0].value
				this.rollInfo2.gap = Number((Number(gapds2.data.tagList[0].value) + Number(gapos2.data.tagList[0].value)) / 2).toFixed(3)
				this.rollInfo2.force = Number((Number(forceDs2.data.tagList[0].value) + Number(forceOs2.data.tagList[0].value)) / 2).toFixed(3)
				this.rollInfo2.current = current2.data.tagList[0].value
				// 3#轧机
				let current3 = await post('/webservice/getHmiData', {
					tags: [
						{
						  name: "FM_SCAN.F3Current",
						  ts: "1"
						},
					  ]
				})
				let speed3 = await post('/webservice/getHmiData', {
					tags: [
						{
						  name: "FM_SCAN.F3Speed",
						  ts: "1"
						},
					  ]
				})
				let gapds3 = await post('/webservice/getHmiData', {
					tags: [
						{
						  name: "FM_SCAN.F3GapDS", // 辊缝DS
						  ts: "1"
						},
					  ]
				})
				let gapos3 = await post('/webservice/getHmiData', {
					tags: [
						{
						  name: "FM_SCAN.F3GapOS", // 辊缝OS
						  ts: "1"
						},
					  ]
				})
				let forceDs3 = await post('/webservice/getHmiData', {
					tags: [
						{
						  name: "FM_SCAN.F3ForceDS", // 轧制力DS
						  ts: "1"
						},
					  ]
				})
				let forceOs3 = await post('/webservice/getHmiData', {
					tags: [
						{
						  name: "FM_SCAN.F3ForceOS", // 轧制力OS
						  ts: "1"
						},
					  ]
				})
				this.rollInfo3.speed = speed3.data.tagList[0].value
				this.rollInfo3.gap = Number((Number(gapds3.data.tagList[0].value) + Number(gapos3.data.tagList[0].value)) / 2).toFixed(3)
				this.rollInfo3.force = Number((Number(forceDs3.data.tagList[0].value) + Number(forceOs3.data.tagList[0].value)) / 2).toFixed(3)
				this.rollInfo3.current = current3.data.tagList[0].value
				// 4#轧机
				let current4 = await post('/webservice/getHmiData', {
					tags: [
						{
						  name: "FM_SCAN.F4Current",
						  ts: "1"
						},
					  ]
				})
				let speed4 = await post('/webservice/getHmiData', {
					tags: [
						{
						  name: "FM_SCAN.F4Speed",
						  ts: "1"
						},
					  ]
				})
				let gapds4 = await post('/webservice/getHmiData', {
					tags: [
						{
						  name: "FM_SCAN.F4GapDS", // 辊缝DS
						  ts: "1"
						},
					  ]
				})
				let gapos4 = await post('/webservice/getHmiData', {
					tags: [
						{
						  name: "FM_SCAN.F4GapOS", // 辊缝OS
						  ts: "1"
						},
					  ]
				})
				let forceDs4 = await post('/webservice/getHmiData', {
					tags: [
						{
						  name: "FM_SCAN.F4ForceDS", // 轧制力DS
						  ts: "1"
						},
					  ]
				})
				let forceOs4 = await post('/webservice/getHmiData', {
					tags: [
						{
						  name: "FM_SCAN.F4ForceOS", // 轧制力OS
						  ts: "1"
						},
					  ]
				})
				this.rollInfo4.speed = speed4.data.tagList[0].value
				this.rollInfo4.gap = Number((Number(gapds4.data.tagList[0].value) + Number(gapos4.data.tagList[0].value)) / 2).toFixed(3)
				this.rollInfo4.force = Number((Number(forceDs4.data.tagList[0].value) + Number(forceOs4.data.tagList[0].value)) / 2).toFixed(3)
				this.rollInfo4.current = current4.data.tagList[0].value
				// 5#轧机
				let current5 = await post('/webservice/getHmiData', {
					tags: [
						{
						  name: "FM_SCAN.F5Current",
						  ts: "1"
						},
					  ]
				})
				let speed5 = await post('/webservice/getHmiData', {
					tags: [
						{
						  name: "FM_SCAN.F5Speed",
						  ts: "1"
						},
					  ]
				})
				let gapds5 = await post('/webservice/getHmiData', {
					tags: [
						{
						  name: "FM_SCAN.F5GapDS", // 辊缝DS
						  ts: "1"
						},
					  ]
				})
				let gapos5 = await post('/webservice/getHmiData', {
					tags: [
						{
						  name: "FM_SCAN.F5GapOS", // 辊缝OS
						  ts: "1"
						},
					  ]
				})
				let forceDs5 = await post('/webservice/getHmiData', {
					tags: [
						{
						  name: "FM_SCAN.F5ForceDS", // 轧制力DS
						  ts: "1"
						},
					  ]
				})
				let forceOs5 = await post('/webservice/getHmiData', {
					tags: [
						{
						  name: "FM_SCAN.F5ForceOS", // 轧制力OS
						  ts: "1"
						},
					  ]
				})
				this.rollInfo5.speed = speed5.data.tagList[0].value
				this.rollInfo5.gap = Number((Number(gapds5.data.tagList[0].value) + Number(gapos5.data.tagList[0].value)) / 2).toFixed(3)
				this.rollInfo5.force = Number((Number(forceDs5.data.tagList[0].value) + Number(forceOs5.data.tagList[0].value)) / 2).toFixed(3)
				this.rollInfo5.current = current5.data.tagList[0].value
				// 6#轧机
				let current6 = await post('/webservice/getHmiData', {
					tags: [
						{
						  name: "FM_SCAN.F6Current",
						  ts: "1"
						},
					  ]
				})
				let speed6 = await post('/webservice/getHmiData', {
					tags: [
						{
						  name: "FM_SCAN.F6Speed",
						  ts: "1"
						},
					  ]
				})
				let gapds6 = await post('/webservice/getHmiData', {
					tags: [
						{
						  name: "FM_SCAN.F6GapDS", // 辊缝DS
						  ts: "1"
						},
					  ]
				})
				let gapos6 = await post('/webservice/getHmiData', {
					tags: [
						{
						  name: "FM_SCAN.F6GapOS", // 辊缝OS
						  ts: "1"
						},
					  ]
				})
				let forceDs6 = await post('/webservice/getHmiData', {
					tags: [
						{
						  name: "FM_SCAN.F6ForceDS", // 轧制力DS
						  ts: "1"
						},
					  ]
				})
				let forceOs6 = await post('/webservice/getHmiData', {
					tags: [
						{
						  name: "FM_SCAN.F6ForceOS", // 轧制力OS
						  ts: "1"
						},
					  ]
				})
				this.rollInfo6.speed = speed6.data.tagList[0].value
				this.rollInfo6.gap = Number((Number(gapds6.data.tagList[0].value) + Number(gapos6.data.tagList[0].value)) / 2).toFixed(3)
				this.rollInfo6.force = Number((Number(forceDs6.data.tagList[0].value) + Number(forceOs6.data.tagList[0].value)) / 2).toFixed(3)
				this.rollInfo6.current = current6.data.tagList[0].value
				// 7#轧机
				let current7 = await post('/webservice/getHmiData', {
					tags: [
						{
						  name: "FM_SCAN.F7Current",
						  ts: "1"
						},
					  ]
				})
				let speed7 = await post('/webservice/getHmiData', {
					tags: [
						{
						  name: "FM_SCAN.F7Speed",
						  ts: "1"
						},
					  ]
				})
				let gapds7 = await post('/webservice/getHmiData', {
					tags: [
						{
						  name: "FM_SCAN.F7GapDS", // 辊缝DS
						  ts: "1"
						},
					  ]
				})
				let gapos7 = await post('/webservice/getHmiData', {
					tags: [
						{
						  name: "FM_SCAN.F7GapOS", // 辊缝OS
						  ts: "1"
						},
					  ]
				})
				let forceDs7 = await post('/webservice/getHmiData', {
					tags: [
						{
						  name: "FM_SCAN.F7ForceDS", // 轧制力DS
						  ts: "1"
						},
					  ]
				})
				let forceOs7 = await post('/webservice/getHmiData', {
					tags: [
						{
						  name: "FM_SCAN.F7ForceOS", // 轧制力OS
						  ts: "1"
						},
					  ]
				})
				this.rollInfo7.speed = speed7.data.tagList[0].value
				this.rollInfo7.gap = Number((Number(gapds7.data.tagList[0].value) + Number(gapos7.data.tagList[0].value)) / 2).toFixed(3)
				this.rollInfo7.force = Number((Number(forceDs7.data.tagList[0].value) + Number(forceOs7.data.tagList[0].value)) / 2).toFixed(3)
				this.rollInfo7.current = current7.data.tagList[0].value
				
			}
		}
	}
</script>

<style>
	.mo-main {
		width: 100%;
		height: 425upx;
		opacity: 1;
		background: #f5f5f5;
		border-radius: 6upx;
		position: relative;
	}
	.steel-coil-info {
		padding: 30upx 0 20upx 0;
	}
	.roll-info {
		padding-top: 20upx;
	}
	.rollCu {
		position: absolute;
		top: 89upx;
		left: 50%;
		transform: translateX(-50%);
	}
	.cu-zhuangtai {
		bottom: 34upx;
		position: absolute;
		font-size: 60upx;
	}
	.rotate {
		transform:rotate(90deg);
		-ms-transform:rotate(90deg); /* Internet Explorer */
		-moz-transform:rotate(90deg); /* Firefox */
		-webkit-transform:rotate(90deg); /* Safari 和 Chrome */
		-o-transform:rotate(9deg); /* Opera */
	}
</style>

